items = ['a', 'b', 'c']

from itertools import permutations

for p in permutations(items):  # 所有的排列组合A3 3
    print(p)

for p in permutations(items, 2):  # 所有的两两排列组合A 3 2
    print(p)

from itertools import combinations

for c in combinations(items, 3):  # 输出所有的组合，并非排列组合 C 3 2
    print(c)

from itertools import combinations_with_replacement

for c in combinations_with_replacement(items, 2):  # 允许同一个元素被选择多次
    print(c)
